function data = readData(input)
    %% calculate matrix size
    f = fopen(input,'r');
    count = 0;
    max = 0;
    while 1
        tline = fgetl(f);
        if ~ischar(tline), break, end
        s = sum(tline==' ');
        if s > max, max = s; end
        count = count+1;
    end
    fprintf(1,'size : %d * %d\n',count,max);
    %% read data
    fseek(f, 0, 'bof');
    data = zeros(count, max);
    j = 1;
    while 1
        tline = fgetl(f);
        if ~ischar(tline), break, end
        a = sscanf(tline, '%f');
        k = length(a);
        if k > max
            fprintf(2,'k=%d max=%d\n',k,max);
            k = max;
        end
        a=a';
        data(j,1:k) = a(1,1:k);
        j = j+1;
    end
    fclose(f);
end
